<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="事件上报信息表ID" prop="reportEventId">
        <el-input
          v-model="queryParams.reportEventId"
          placeholder="请输入事件上报信息表ID"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="科室讨论日期" prop="discussionDepartmentDate">
        <el-date-picker clearable
          v-model="queryParams.discussionDepartmentDate"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="请选择科室讨论日期">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="地点" prop="discussionSite">
        <el-input
          v-model="queryParams.discussionSite"
          placeholder="请输入地点"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="事件是否累及患者" prop="discussionInvolvesPatient">
        <el-select v-model="queryParams.discussionInvolvesPatient" placeholder="请选择事件是否累及患者" clearable>
          <el-option
            v-for="dict in dict.type.he_discussion_involves_patient"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="是否给患者造成伤害" prop="discussionHurtPatient">
        <el-select v-model="queryParams.discussionHurtPatient" placeholder="请选择是否给患者造成伤害" clearable>
          <el-option
            v-for="dict in dict.type.he_discussion_hurt_patient"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="患者是否知晓" prop="discussionPatientKnows">
        <el-select v-model="queryParams.discussionPatientKnows" placeholder="请选择患者是否知晓" clearable>
          <el-option
            v-for="dict in dict.type.he_discussion_patient_knows"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="家属是否知晓" prop="discussionFamilyKnows">
        <el-select v-model="queryParams.discussionFamilyKnows" placeholder="请选择家属是否知晓" clearable>
          <el-option
            v-for="dict in dict.type.he_discussion_family_knows"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="是否存在纠纷隐患" prop="discussionPotentialDispute">
        <el-select v-model="queryParams.discussionPotentialDispute" placeholder="请选择是否存在纠纷隐患" clearable>
          <el-option
            v-for="dict in dict.type.he_discussion_potential_dispute"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="科室讨论定性等级" prop="discussionQualitativeLevels">
        <el-select v-model="queryParams.discussionQualitativeLevels" placeholder="请选择科室讨论定性等级" clearable>
          <el-option
            v-for="dict in dict.type.he_discussion_qualitative_levels"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="医疗事故" prop="discussionMedicalMalpractice">
        <el-select v-model="queryParams.discussionMedicalMalpractice" placeholder="请选择医疗事故" clearable>
          <el-option
            v-for="dict in dict.type.he_discussion_medical_malpractice"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="医护人员" prop="possibleCausesWorkers">
        <el-select v-model="queryParams.possibleCausesWorkers" placeholder="请选择医护人员" clearable>
          <el-option
            v-for="dict in dict.type.he_possible_causes_workers"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="患者" prop="possibleCausesPatient">
        <el-select v-model="queryParams.possibleCausesPatient" placeholder="请选择患者" clearable>
          <el-option
            v-for="dict in dict.type.he_possible_causes_patient"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="家属/陪护" prop="possibleCausesFamily">
        <el-select v-model="queryParams.possibleCausesFamily" placeholder="请选择家属/陪护" clearable>
          <el-option
            v-for="dict in dict.type.he_possible_causes_family"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="器材设备" prop="possibleCausesEquipment">
        <el-select v-model="queryParams.possibleCausesEquipment" placeholder="请选择器材设备" clearable>
          <el-option
            v-for="dict in dict.type.he_possible_causes_equipment"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="耗材药品" prop="possibleCausesConsumableDrug">
        <el-select v-model="queryParams.possibleCausesConsumableDrug" placeholder="请选择耗材药品" clearable>
          <el-option
            v-for="dict in dict.type.he_possible_causes_consumable_drug"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="流程制度" prop="possibleCausesProcessSystem">
        <el-select v-model="queryParams.possibleCausesProcessSystem" placeholder="请选择流程制度" clearable>
          <el-option
            v-for="dict in dict.type.he_possible_causes_process_system"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="环境" prop="possibleCausesEnvironment">
        <el-select v-model="queryParams.possibleCausesEnvironment" placeholder="请选择环境" clearable>
          <el-option
            v-for="dict in dict.type.he_possible_causes_environment"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="加强教育培训" prop="measureStrengthenEducation">
        <el-select v-model="queryParams.measureStrengthenEducation" placeholder="请选择加强教育培训" clearable>
          <el-option
            v-for="dict in dict.type.he_measure_strengthen_education"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="改善医疗护理管理" prop="measureCareManagement">
        <el-select v-model="queryParams.measureCareManagement" placeholder="请选择改善医疗护理管理" clearable>
          <el-option
            v-for="dict in dict.type.he_measure_care_management"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="改善行政管理" prop="measureImproveAdministration">
        <el-select v-model="queryParams.measureImproveAdministration" placeholder="请选择改善行政管理" clearable>
          <el-option
            v-for="dict in dict.type.he_measure_improve_administration"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="加强沟通方式" prop="measureStrengthenCommunication">
        <el-select v-model="queryParams.measureStrengthenCommunication" placeholder="请选择加强沟通方式" clearable>
          <el-option
            v-for="dict in dict.type.he_measure_strengthen_communication"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="处理图片" prop="disposePhoto">
        <el-input
          v-model="queryParams.disposePhoto"
          placeholder="请输入处理图片"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="备注1" prop="note1">
        <el-input
          v-model="queryParams.note1"
          placeholder="请输入备注1"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="备注2" prop="note2">
        <el-input
          v-model="queryParams.note2"
          placeholder="请输入备注2"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="备注3" prop="note3">
        <el-input
          v-model="queryParams.note3"
          placeholder="请输入备注3"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="备注4" prop="note4">
        <el-input
          v-model="queryParams.note4"
          placeholder="请输入备注4"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="备注5" prop="note5">
        <el-input
          v-model="queryParams.note5"
          placeholder="请输入备注5"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="备注6" prop="note6">
        <el-input
          v-model="queryParams.note6"
          placeholder="请输入备注6"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="备注7" prop="note7">
        <el-input
          v-model="queryParams.note7"
          placeholder="请输入备注7"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="备注8" prop="note8">
        <el-input
          v-model="queryParams.note8"
          placeholder="请输入备注8"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="备注9" prop="note9">
        <el-input
          v-model="queryParams.note9"
          placeholder="请输入备注9"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="备注10" prop="note10">
        <el-input
          v-model="queryParams.note10"
          placeholder="请输入备注10"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="创建时间" prop="creationTime">
        <el-date-picker clearable
          v-model="queryParams.creationTime"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="请选择创建时间">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="用户ID" prop="userId">
        <el-input
          v-model="queryParams.userId"
          placeholder="请输入用户ID"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="部门ID" prop="deptId">
        <el-input
          v-model="queryParams.deptId"
          placeholder="请输入部门ID"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['project:analysis:add']"
        >新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['project:analysis:edit']"
        >修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['project:analysis:remove']"
        >删除</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['project:analysis:export']"
        >导出</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="analysisList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="id" align="center" prop="id" />
      <el-table-column label="事件上报信息表ID" align="center" prop="reportEventId" />
      <el-table-column label="科室讨论日期" align="center" prop="discussionDepartmentDate" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.discussionDepartmentDate, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="地点" align="center" prop="discussionSite" />
      <el-table-column label="参加讨论人员" align="center" prop="discussionPanelist" />
      <el-table-column label="事件是否累及患者" align="center" prop="discussionInvolvesPatient">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.he_discussion_involves_patient" :value="scope.row.discussionInvolvesPatient"/>
        </template>
      </el-table-column>
      <el-table-column label="是否给患者造成伤害" align="center" prop="discussionHurtPatient">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.he_discussion_hurt_patient" :value="scope.row.discussionHurtPatient"/>
        </template>
      </el-table-column>
      <el-table-column label="患者是否知晓" align="center" prop="discussionPatientKnows">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.he_discussion_patient_knows" :value="scope.row.discussionPatientKnows"/>
        </template>
      </el-table-column>
      <el-table-column label="家属是否知晓" align="center" prop="discussionFamilyKnows">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.he_discussion_family_knows" :value="scope.row.discussionFamilyKnows"/>
        </template>
      </el-table-column>
      <el-table-column label="是否存在纠纷隐患" align="center" prop="discussionPotentialDispute">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.he_discussion_potential_dispute" :value="scope.row.discussionPotentialDispute"/>
        </template>
      </el-table-column>
      <el-table-column label="科室讨论定性等级" align="center" prop="discussionQualitativeLevels">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.he_discussion_qualitative_levels" :value="scope.row.discussionQualitativeLevels"/>
        </template>
      </el-table-column>
      <el-table-column label="医疗事故" align="center" prop="discussionMedicalMalpractice">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.he_discussion_medical_malpractice" :value="scope.row.discussionMedicalMalpractice"/>
        </template>
      </el-table-column>
      <el-table-column label="科室处理意见" align="center" prop="discussionHandSuggestion" />
      <el-table-column label="医护人员" align="center" prop="possibleCausesWorkers">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.he_possible_causes_workers" :value="scope.row.possibleCausesWorkers"/>
        </template>
      </el-table-column>
      <el-table-column label="患者" align="center" prop="possibleCausesPatient">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.he_possible_causes_patient" :value="scope.row.possibleCausesPatient"/>
        </template>
      </el-table-column>
      <el-table-column label="家属/陪护" align="center" prop="possibleCausesFamily">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.he_possible_causes_family" :value="scope.row.possibleCausesFamily"/>
        </template>
      </el-table-column>
      <el-table-column label="器材设备" align="center" prop="possibleCausesEquipment">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.he_possible_causes_equipment" :value="scope.row.possibleCausesEquipment"/>
        </template>
      </el-table-column>
      <el-table-column label="耗材药品" align="center" prop="possibleCausesConsumableDrug">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.he_possible_causes_consumable_drug" :value="scope.row.possibleCausesConsumableDrug"/>
        </template>
      </el-table-column>
      <el-table-column label="流程制度" align="center" prop="possibleCausesProcessSystem">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.he_possible_causes_process_system" :value="scope.row.possibleCausesProcessSystem"/>
        </template>
      </el-table-column>
      <el-table-column label="环境" align="center" prop="possibleCausesEnvironment">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.he_possible_causes_environment" :value="scope.row.possibleCausesEnvironment"/>
        </template>
      </el-table-column>
      <el-table-column label="加强教育培训" align="center" prop="measureStrengthenEducation">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.he_measure_strengthen_education" :value="scope.row.measureStrengthenEducation"/>
        </template>
      </el-table-column>
      <el-table-column label="改善医疗护理管理" align="center" prop="measureCareManagement">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.he_measure_care_management" :value="scope.row.measureCareManagement"/>
        </template>
      </el-table-column>
      <el-table-column label="改善行政管理" align="center" prop="measureImproveAdministration">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.he_measure_improve_administration" :value="scope.row.measureImproveAdministration"/>
        </template>
      </el-table-column>
      <el-table-column label="加强沟通方式" align="center" prop="measureStrengthenCommunication">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.he_measure_strengthen_communication" :value="scope.row.measureStrengthenCommunication"/>
        </template>
      </el-table-column>
      <el-table-column label="处理图片" align="center" prop="disposePhoto" />
      <el-table-column label="备注1" align="center" prop="note1" />
      <el-table-column label="备注2" align="center" prop="note2" />
      <el-table-column label="备注3" align="center" prop="note3" />
      <el-table-column label="备注4" align="center" prop="note4" />
      <el-table-column label="备注5" align="center" prop="note5" />
      <el-table-column label="备注6" align="center" prop="note6" />
      <el-table-column label="备注7" align="center" prop="note7" />
      <el-table-column label="备注8" align="center" prop="note8" />
      <el-table-column label="备注9" align="center" prop="note9" />
      <el-table-column label="备注10" align="center" prop="note10" />
      <el-table-column label="创建时间" align="center" prop="creationTime" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.creationTime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="用户ID" align="center" prop="userId" />
      <el-table-column label="部门ID" align="center" prop="deptId" />
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['project:analysis:edit']"
          >修改</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['project:analysis:remove']"
          >删除</el-button>
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改分析报告
对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-form-item label="事件上报信息表ID" prop="reportEventId">
          <el-input v-model="form.reportEventId" placeholder="请输入事件上报信息表ID" />
        </el-form-item>
        <el-form-item label="科室讨论日期" prop="discussionDepartmentDate">
          <el-date-picker clearable
            v-model="form.discussionDepartmentDate"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择科室讨论日期">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="地点" prop="discussionSite">
          <el-input v-model="form.discussionSite" placeholder="请输入地点" />
        </el-form-item>
        <el-form-item label="参加讨论人员" prop="discussionPanelist">
          <el-input v-model="form.discussionPanelist" type="textarea" placeholder="请输入内容" />
        </el-form-item>
        <el-form-item label="事件是否累及患者" prop="discussionInvolvesPatient">
          <el-select v-model="form.discussionInvolvesPatient" placeholder="请选择事件是否累及患者">
            <el-option
              v-for="dict in dict.type.he_discussion_involves_patient"
              :key="dict.value"
              :label="dict.label"
              :value="dict.value"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="是否给患者造成伤害" prop="discussionHurtPatient">
          <el-select v-model="form.discussionHurtPatient" placeholder="请选择是否给患者造成伤害">
            <el-option
              v-for="dict in dict.type.he_discussion_hurt_patient"
              :key="dict.value"
              :label="dict.label"
              :value="dict.value"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="患者是否知晓" prop="discussionPatientKnows">
          <el-select v-model="form.discussionPatientKnows" placeholder="请选择患者是否知晓">
            <el-option
              v-for="dict in dict.type.he_discussion_patient_knows"
              :key="dict.value"
              :label="dict.label"
              :value="dict.value"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="家属是否知晓" prop="discussionFamilyKnows">
          <el-select v-model="form.discussionFamilyKnows" placeholder="请选择家属是否知晓">
            <el-option
              v-for="dict in dict.type.he_discussion_family_knows"
              :key="dict.value"
              :label="dict.label"
              :value="dict.value"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="是否存在纠纷隐患" prop="discussionPotentialDispute">
          <el-select v-model="form.discussionPotentialDispute" placeholder="请选择是否存在纠纷隐患">
            <el-option
              v-for="dict in dict.type.he_discussion_potential_dispute"
              :key="dict.value"
              :label="dict.label"
              :value="dict.value"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="科室讨论定性等级" prop="discussionQualitativeLevels">
          <el-select v-model="form.discussionQualitativeLevels" placeholder="请选择科室讨论定性等级">
            <el-option
              v-for="dict in dict.type.he_discussion_qualitative_levels"
              :key="dict.value"
              :label="dict.label"
              :value="dict.value"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="医疗事故" prop="discussionMedicalMalpractice">
          <el-select v-model="form.discussionMedicalMalpractice" placeholder="请选择医疗事故">
            <el-option
              v-for="dict in dict.type.he_discussion_medical_malpractice"
              :key="dict.value"
              :label="dict.label"
              :value="dict.value"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="科室处理意见" prop="discussionHandSuggestion">
          <el-input v-model="form.discussionHandSuggestion" type="textarea" placeholder="请输入内容" />
        </el-form-item>
        <el-form-item label="医护人员" prop="possibleCausesWorkers">
          <el-select v-model="form.possibleCausesWorkers" placeholder="请选择医护人员">
            <el-option
              v-for="dict in dict.type.he_possible_causes_workers"
              :key="dict.value"
              :label="dict.label"
              :value="dict.value"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="患者" prop="possibleCausesPatient">
          <el-select v-model="form.possibleCausesPatient" placeholder="请选择患者">
            <el-option
              v-for="dict in dict.type.he_possible_causes_patient"
              :key="dict.value"
              :label="dict.label"
              :value="dict.value"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="家属/陪护" prop="possibleCausesFamily">
          <el-select v-model="form.possibleCausesFamily" placeholder="请选择家属/陪护">
            <el-option
              v-for="dict in dict.type.he_possible_causes_family"
              :key="dict.value"
              :label="dict.label"
              :value="dict.value"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="器材设备" prop="possibleCausesEquipment">
          <el-select v-model="form.possibleCausesEquipment" placeholder="请选择器材设备">
            <el-option
              v-for="dict in dict.type.he_possible_causes_equipment"
              :key="dict.value"
              :label="dict.label"
              :value="dict.value"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="耗材药品" prop="possibleCausesConsumableDrug">
          <el-select v-model="form.possibleCausesConsumableDrug" placeholder="请选择耗材药品">
            <el-option
              v-for="dict in dict.type.he_possible_causes_consumable_drug"
              :key="dict.value"
              :label="dict.label"
              :value="dict.value"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="流程制度" prop="possibleCausesProcessSystem">
          <el-select v-model="form.possibleCausesProcessSystem" placeholder="请选择流程制度">
            <el-option
              v-for="dict in dict.type.he_possible_causes_process_system"
              :key="dict.value"
              :label="dict.label"
              :value="dict.value"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="环境" prop="possibleCausesEnvironment">
          <el-select v-model="form.possibleCausesEnvironment" placeholder="请选择环境">
            <el-option
              v-for="dict in dict.type.he_possible_causes_environment"
              :key="dict.value"
              :label="dict.label"
              :value="dict.value"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="加强教育培训" prop="measureStrengthenEducation">
          <el-select v-model="form.measureStrengthenEducation" placeholder="请选择加强教育培训">
            <el-option
              v-for="dict in dict.type.he_measure_strengthen_education"
              :key="dict.value"
              :label="dict.label"
              :value="dict.value"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="改善医疗护理管理" prop="measureCareManagement">
          <el-select v-model="form.measureCareManagement" placeholder="请选择改善医疗护理管理">
            <el-option
              v-for="dict in dict.type.he_measure_care_management"
              :key="dict.value"
              :label="dict.label"
              :value="dict.value"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="改善行政管理" prop="measureImproveAdministration">
          <el-select v-model="form.measureImproveAdministration" placeholder="请选择改善行政管理">
            <el-option
              v-for="dict in dict.type.he_measure_improve_administration"
              :key="dict.value"
              :label="dict.label"
              :value="dict.value"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="加强沟通方式" prop="measureStrengthenCommunication">
          <el-select v-model="form.measureStrengthenCommunication" placeholder="请选择加强沟通方式">
            <el-option
              v-for="dict in dict.type.he_measure_strengthen_communication"
              :key="dict.value"
              :label="dict.label"
              :value="dict.value"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="处理图片" prop="disposePhoto">
          <el-input v-model="form.disposePhoto" placeholder="请输入处理图片" />
        </el-form-item>
        <el-form-item label="备注1" prop="note1">
          <el-input v-model="form.note1" placeholder="请输入备注1" />
        </el-form-item>
        <el-form-item label="备注2" prop="note2">
          <el-input v-model="form.note2" placeholder="请输入备注2" />
        </el-form-item>
        <el-form-item label="备注3" prop="note3">
          <el-input v-model="form.note3" placeholder="请输入备注3" />
        </el-form-item>
        <el-form-item label="备注4" prop="note4">
          <el-input v-model="form.note4" placeholder="请输入备注4" />
        </el-form-item>
        <el-form-item label="备注5" prop="note5">
          <el-input v-model="form.note5" placeholder="请输入备注5" />
        </el-form-item>
        <el-form-item label="备注6" prop="note6">
          <el-input v-model="form.note6" placeholder="请输入备注6" />
        </el-form-item>
        <el-form-item label="备注7" prop="note7">
          <el-input v-model="form.note7" placeholder="请输入备注7" />
        </el-form-item>
        <el-form-item label="备注8" prop="note8">
          <el-input v-model="form.note8" placeholder="请输入备注8" />
        </el-form-item>
        <el-form-item label="备注9" prop="note9">
          <el-input v-model="form.note9" placeholder="请输入备注9" />
        </el-form-item>
        <el-form-item label="备注10" prop="note10">
          <el-input v-model="form.note10" placeholder="请输入备注10" />
        </el-form-item>
        <el-form-item label="创建时间" prop="creationTime">
          <el-date-picker clearable
            v-model="form.creationTime"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择创建时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="用户ID" prop="userId">
          <el-input v-model="form.userId" placeholder="请输入用户ID" />
        </el-form-item>
        <el-form-item label="部门ID" prop="deptId">
          <el-input v-model="form.deptId" placeholder="请输入部门ID" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { listAnalysis, getAnalysis, delAnalysis, addAnalysis, updateAnalysis } from "@/api/project/analysis";

export default {
  name: "Analysis",
  dicts: ['he_discussion_involves_patient', 'he_possible_causes_consumable_drug', 'he_measure_strengthen_communication', 'he_possible_causes_patient', 'he_possible_causes_family', 'he_possible_causes_environment', 'he_possible_causes_equipment', 'he_measure_care_management', 'he_discussion_medical_malpractice', 'he_discussion_patient_knows', 'he_discussion_qualitative_levels', 'he_possible_causes_workers', 'he_discussion_hurt_patient', 'he_possible_causes_process_system', 'he_measure_improve_administration', 'he_measure_strengthen_education', 'he_discussion_family_knows', 'he_discussion_potential_dispute'],
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 分析报告表格数据
      analysisList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        reportEventId: null,
        discussionDepartmentDate: null,
        discussionSite: null,
        discussionPanelist: null,
        discussionInvolvesPatient: null,
        discussionHurtPatient: null,
        discussionPatientKnows: null,
        discussionFamilyKnows: null,
        discussionPotentialDispute: null,
        discussionQualitativeLevels: null,
        discussionMedicalMalpractice: null,
        discussionHandSuggestion: null,
        possibleCausesWorkers: null,
        possibleCausesPatient: null,
        possibleCausesFamily: null,
        possibleCausesEquipment: null,
        possibleCausesConsumableDrug: null,
        possibleCausesProcessSystem: null,
        possibleCausesEnvironment: null,
        measureStrengthenEducation: null,
        measureCareManagement: null,
        measureImproveAdministration: null,
        measureStrengthenCommunication: null,
        disposePhoto: null,
        note1: null,
        note2: null,
        note3: null,
        note4: null,
        note5: null,
        note6: null,
        note7: null,
        note8: null,
        note9: null,
        note10: null,
        creationTime: null,
        userId: null,
        deptId: null
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
      }
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** 查询分析报告列表 */
    getList() {
      this.loading = true;
      listAnalysis(this.queryParams).then(response => {
        this.analysisList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        reportEventId: null,
        discussionDepartmentDate: null,
        discussionSite: null,
        discussionPanelist: null,
        discussionInvolvesPatient: null,
        discussionHurtPatient: null,
        discussionPatientKnows: null,
        discussionFamilyKnows: null,
        discussionPotentialDispute: null,
        discussionQualitativeLevels: null,
        discussionMedicalMalpractice: null,
        discussionHandSuggestion: null,
        possibleCausesWorkers: null,
        possibleCausesPatient: null,
        possibleCausesFamily: null,
        possibleCausesEquipment: null,
        possibleCausesConsumableDrug: null,
        possibleCausesProcessSystem: null,
        possibleCausesEnvironment: null,
        measureStrengthenEducation: null,
        measureCareManagement: null,
        measureImproveAdministration: null,
        measureStrengthenCommunication: null,
        disposePhoto: null,
        note1: null,
        note2: null,
        note3: null,
        note4: null,
        note5: null,
        note6: null,
        note7: null,
        note8: null,
        note9: null,
        note10: null,
        creationTime: null,
        updateTime: null,
        userId: null,
        deptId: null
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加分析报告";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.id || this.ids
      getAnalysis(id).then(response => {
        this.form = response.data;
        this.open = true;
        this.title = "修改分析报告";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.id != null) {
            updateAnalysis(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addAnalysis(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$modal.confirm('是否确认删除分析报告编号为"' + ids + '"的数据项？').then(function() {
        return delAnalysis(ids);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('project/analysis/export', {
        ...this.queryParams
      }, `analysis_${new Date().getTime()}.xlsx`)
    }
  }
};
</script>
